.PHONY:	test
test:
	@echo "test"

.PHONY: build-clean
build-clean:
	rm -rf ./build/*

.PHONY: build-win
build-win:
	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./build/windows/im-server ./cmd/im/main.go
	cp -r ./config ./build/windows/
	cp -r ./public ./build/windows/
	cp -r ./templates ./build/windows/
	cp -r ./Makefile ./build/windows/

.PHONY: build-linux
build-linux:
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/linux/im-server ./cmd/im/main.go
	cp -r ./config ./build/linux/config
	cp -r ./public ./build/linux/public
	cp -r ./templates ./build/linux/
	cp -r ./Makefile ./build/linux/


.PHONY: proto
proto:
	protoc --proto_path=./im/rpc --go_out=./im/rpc --go_opt=paths=source_relative \
	--go-grpc_out=./im/rpc --go-grpc_opt=paths=source_relative chat.proto

.PHONY: dev-http-start
dev-http-start:
	go run ./cmd/im/main.go http_start

.PHONY: dev-im-start
dev-im-start:
	go run ./cmd/im/main.go im_start

.PHONY: prod-http-start
prod-http-start:
	nohup ./im-server http_start > ./http.log 2>&1 &

.PHONY: prod-http-stop
prod-http-stop:
	nohup ./im-server http_stop > ./http.log 2>&1 &

.PHONY: prod-im-start
prod-im-start:
	nohup ./im-server im_start > ./im.log 2>&1 &

.PHONY: prod-im-stop
prod-im-stop:
	nohup ./im-server im_stop > ./im.log 2>&1 &



